export function throttle(fn, wait) {
    // let timer;
    // return function () {
    //     console.log("调用修改功能");
    //     if (!timer) {
    //         let content = this;
    //         timer = setTimeout(function () {
    //             timer = null;
    //             fn.call(content);
    //         }, interval)
    //     }
    let last, timer, now;
    return function () {
        now = Date.now();
        if (last && now - last < wait) {
            clearTimeout(timer);
            timer = setTimeout(function () {
                last = now;
                fn.call(this, ...arguments);
            }, 2000);
        } else {
            last = now;
            fn.call(this, ...arguments);
        }
    };

}
export function throttleFirstExt(f, t) {
    let flag = true;
    return (...args) => {
        if (flag) {
            f(...args);
            flag = false;
            setTimeout(() => {
                flag = true
            }, t)
        }
    }
}
